#ifndef _ENGINEOBJECT_H
#define _ENGINEOBJECT_H

#include "..\common\types.h"
#include "..\common\def.h"
#include "..\common\string.h"
#include "..\math\matrix.h"
#include "..\math\vector.h"
#include "..\sound\dsound.h"

struct D3DModel; 
class CActor;
class CD3D9Device;
class CDSound9Device;
class CDInput9Device;
class CPhysics;

class EE_EXPORT CObject
{
	friend class CEngine; 
	friend class CActor; 

	CD3D9Device* mp_Renderer;
	EESound::CDSound9Device* mp_Sound;
	CDInput9Device* mp_Input;
	CPhysics* mp_Physics;
protected:

	CD3D9Device* GetRenderer();
	EESound::CDSound9Device* GetSound();
	CDInput9Device* GetInput();
	CPhysics* GetPhyisics();


	Matrix4f	m_transform; 
	Vector3f	m_velocity; 
	D3DModel	*m_pModel; 
	CActor		*m_pPhysics;

public:

	CObject(void); 
	virtual ~CObject(void)	{ }

	inline Vector3f getPosition(void)
	{
		return m_transform.Translation(); 
	}
	virtual void setPosition(const Vector3f &position); 
	void setVelocity(const Vector3f &velocity);
	Vector3f GetVelocity();

	virtual void	SetTransform(const Matrix4f &t); 

	D3DModel* getModel(); 


	Matrix4f GetTransform(void) const
	{
		return m_transform; 
	}

	virtual HRESULT Release(void); 
	virtual HRESULT Create(void); 

	virtual void	Update(const float dt);

	virtual void	Draw(void); 

	virtual void OnCollisionEvent(const Vector3f& contactPoint, const Vector3f& contactNormal, CObject* pOtherObject) {}
	virtual bool isManaged();
	virtual bool isValid();
	friend class CPhysics; 
	
}; 
#endif
